package my.framework.comm;

import java.util.List;

/**
 * @author:雷淑娥
 * @Date:2024/12/16 8:48
 * version:1.0
 */
public class PageUtils<T> {
    private int pageIndex;

    private int pageSize;

    private int total;

    private int totalPage;

    private List<T> records;

    public int getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(int pageIndex) {
        this.pageIndex = pageIndex;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getTotalPage() {
        totalPage = total % pageSize == 0 ? total / pageSize : (total / pageSize) + 1;
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public List<T> getRecords() {
        return records;
    }

    public void setRecords(List<T> records) {
        this.records = records;
    }
}
